home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8558 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem Negating an Unsigned Char
  5. Date: 4 Mar 1996 20:56:05 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4hgag5$8r8@solutions.solon.com>
  8. References: <Dnnros.Lq.0.-s@hkusuc.hku.hk> <4he27sINNdel@keats.ugrad.cs.ubc.ca> <4he5f0$acv@solutions.solon.com> <4hfkk6INN2tm@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4hfkk6INN2tm@keats.ugrad.cs.ubc.ca>,
  12. Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  13. >In article <4he5f0$acv@solutions.solon.com>,
  14. >Peter Seebach <seebs@solutions.solon.com> wrote:
  15. > >In article <4he27sINNdel@keats.ugrad.cs.ubc.ca>,
  16. > >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  17. > >>To make it portable, you must manually mask for the lower eight bits:
  18.  
  19. > >>    if (a == (~b & 0xff))
  20.  
  21. > >Close, but the cigar yet escapes you.
  22.  
  23. >No it does not. I _wanted_ eight bit arithmetic, not CHAR_BIT arithmetic.
  24.  
  25. Oh.  I assumed the goal was to get the effect of negating all the bits in
  26. a char.  Never mind.
  27.  
  28. >Your shift, not mine!
  29.  
  30. >I would just AND with UCHAR_MAX. I don't think there is any possibility that
  31. >it could be anything other than a dyadic power, less one.
  32.  
  33. Neither do I, but I'm naturally cautious, often in entirely irrelevant
  34. directions.
  35.  
  36. -s
  37. -- 
  38. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  39. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  40. FUCK the communications decency act.  Goddamned government.  [literally.]
  41. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  42.